﻿package mortal.game.view.copy.QuestionCopy.data
{
    import Message.Public.*;
    import flash.utils.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.view.activeTime.*;

    public class QuestionCopyDataUtil extends Object
    {
        public static var vipType:int = 39;
        public static var TotalNum:int = 20;
        private static var _showCountFlag:Boolean = false;

        public function QuestionCopyDataUtil()
        {
            return;
        }// end function

        public static function getInfo(param1:SQuestionPlayerMsg) : Object
        {
            var _loc_2:Object = {};
            if (param1 == null)
            {
                _loc_2.doubleTotal = 4;
                _loc_2.curDouble = 4;
                _loc_2.curThree = 3;
                _loc_2.threeTotal = 3;
                _loc_2.leftNum = QuestionCopyDataUtil.TotalNum;
                _loc_2.rightNum = 0;
                _loc_2.socre = 0;
                _loc_2.exp = 0;
                _loc_2.hasUsePro = true;
                return _loc_2;
            }
            var _loc_3:* = QuestionCopyConfig.instance().getTotal();
            _loc_2.doubleTotal = _loc_3[0];
            _loc_2.curDouble = param1 == null ? (0) : (_loc_2.doubleTotal - param1.doublePropUsed);
            _loc_2.threeTotal = _loc_3[1];
            _loc_2.curThree = param1 == null ? (0) : (_loc_2.threeTotal - param1.triplePropUsed);
            _loc_2.leftNum = param1 == null ? (0) : (param1.restQuestion);
            _loc_2.rightNum = param1 == null ? (0) : (param1.answerRight);
            _loc_2.socre = param1 == null ? (0) : (param1.score);
            _loc_2.exp = param1 == null ? (0) : (param1.exper);
            _loc_2.hasUsePro = getHasUsePro();
            return _loc_2;
        }// end function

        public static function getHasUsePro() : Boolean
        {
            var _loc_1:Boolean = false;
            var _loc_2:* = Cache.instance.question.curQuesInfo.questionId;
            var _loc_3:* = Cache.instance.question.hasUseTime;
            if (_loc_3[0] == _loc_2)
            {
                if (_loc_3[1] != -1)
                {
                    _loc_1 = true;
                }
                else
                {
                    _loc_1 = false;
                }
            }
            else
            {
                _loc_1 = false;
            }
            return _loc_1;
        }// end function

        public static function getTitleById(param1:int, param2:Dictionary) : Object
        {
            var _loc_3:* = QuestionCopyConfig.instance().questionOjb[param1];
            var _loc_4:Object = {};
            _loc_4.question = _loc_3.question;
            _loc_4.option1 = _loc_3["option" + param2[1]];
            _loc_4.option2 = _loc_3["option" + param2[2]];
            _loc_4.answer = _loc_3.answer == _loc_4.option1 ? (1) : (2);
            return _loc_4;
        }// end function

        public static function canShowCountDownPane() : Boolean
        {
            var _loc_1:int = 0;
            return isInPreTime();
        }// end function

        private static function isInPreTime() : Boolean
        {
            var _loc_1:* = ActiveTimeUtil.getSClientActive(EActiveType._EActiveTypeQuestion);
            if (_loc_1 == null)
            {
                return false;
            }
            var _loc_2:* = ClockManager.instance.isWithinTheTime(_loc_1.startDt.hours, _loc_1.startDt.minutes, _loc_1.startDt.seconds, _loc_1.endDt.hours, _loc_1.endDt.minutes, _loc_1.endDt.seconds);
            return !_loc_2;
        }// end function

        public static function canShowChoicePanel() : Boolean
        {
            var _loc_1:int = 0;
            if (Cache.instance.question.curQuesInfo)
            {
                _loc_1 = Cache.instance.question.curQuesInfo.status;
                if (ECopyStatus._ECopyStatusShowQuestion == Cache.instance.question.curQuesInfo.status || ECopyStatus._ECopyStatusShowAnswer == Cache.instance.question.curQuesInfo.status)
                {
                    return true;
                }
            }
            return false;
        }// end function

        public static function get showCountFlag() : Boolean
        {
            return _showCountFlag;
        }// end function

        public static function set showCountFlag(param1:Boolean) : void
        {
            _showCountFlag = param1;
            return;
        }// end function

    }
}
